function y = China_solve2(X,lambda_b,lambda_g,gamma,theta_b,theta_g,p,q)

x_b = X(1);
y_b = X(2);
x_g = X(3);
y_g = X(4);

C_xb = (1-gamma)*x_b + gamma*((x_b + y_b)^2); % partial derivative of the cost function w.r.t boy's private investment 
C_xg = (1-gamma)*x_g + gamma*((x_g + y_g)^2); % partial derivative of the cost function w.r.t girl's private investment
C_yb = (1-gamma)*y_b + gamma*((x_b + y_b)^2); % partial derivative of the cost function w.r.t boy's public investment
C_yg = (1-gamma)*y_g + gamma*((x_g + y_g)^2); % partial derivative of the cost function w.r.t girl's public investment


V_b = p - 2 *q *(y_b + y_g);  % partial derivative of boy's payoff of public consumption w.r.t boy's public investment
V_g = p - 2 *q *(y_b + y_g);  % partial derivative of girl's payoff of public consumption w.r.t girl's public investment

y1 = C_xb - lambda_b - (1-lambda_g)*theta_b;                 % equation (1)
y2 = C_xg - lambda_g - (1-lambda_b)*theta_g;                 % equation (2)
y3 = C_yb - V_b - ((1-lambda_g)/(1-lambda_b))*theta_b*V_g;   % equation (3)
y4 = C_yg - V_g - ((1-lambda_b)/(1-lambda_g))*theta_g*V_b;   % equation (4)

y = sqrt(y1^2 + y2^2 + y3^2 + y4^2);
